<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>add lot</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--导入核心文件-->
    <script src="../../bootstrap3/js/holder.js" type=""></script>
    <link href="../../bootstrap3/css/bootstrap.css" rel="stylesheet" type="text/css">
    <script src="../../bootstrap3/jquery-1.9.1.min.js" type=""></script>
    <script src="../../bootstrap3/js/bootstrap.js" type=""></script>
    <!-- 字体图标 -->
    <link rel="stylesheet" href="../../bootstrap3/font-awesome-4.7.0/css/font-awesome.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
</head>

<body>
<div id="wrap">
    <div id="top_content">
        <div id="header">
            <div id="rightheader">
                <p>2009/11/20<br /></p>
            </div>
            <div id="topheader">
                <h1 id="title"><a href="#">添加停车场</a></h1>
            </div>
            <div id="navigation"></div>
        </div>
        <div id="content">
            <p id="whereami"></p>
            <!--<h1>add Role info:</h1>-->
            <form id="form-add-new">
                <table cellpadding="0" cellspacing="0" border="0" class="form_table">
                    <tr>
                        <td valign="middle" align="right">停车场名称:</td>
                        <td valign="middle" align="left">
                            <input type="text" class="inputgri" name="name" id="inp-name" />
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" align="right">所在地：</td>
                        <td valign="middle" align="left">
                            <input type="text" class="inputgri" name="location" id="inp-location" />
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" align="right">收费标准：</td>
                        <td valign="middle" align="left">
                            <input type="text" class="inputgri" name="price" id="inp-price" />
                        </td>
                    </tr>
                    <td valign="middle" align="right">经度：</td>
                    <td valign="middle" align="left">
                        <input type="text" class="inputgri" name="longitude" id="inp-longitude" />
                    </td>
                    </tr>
                    <tr>
                        <td valign="middle" align="right">纬度：</td>
                        <td valign="middle" align="left">
                            <input type="text" class="inputgri" name="latitude" id="inp-latitude" />
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" align="right">商家Id：</td>
                        <td valign="middle" align="left">
                            <input type="text" class="inputgri" name="storeId" id="inp-storeId" />
                        </td>
                    </tr>
                </table>
                <p>
                    <input type="button" class="cart-del-sel btn btn-default btn-xs" id="btn-add-new" value="添加"/>
                    <input type="reset" class="cart-del-sel btn btn-default btn-xs" value="重置"/>
                    <input type="button" class="cart-del-sel btn btn-default btn-xs" value="返回" onclick="goBack();"/>
                </p>
            </form>
        </div>
    </div>
    <div id="footer">
        <div id="footer_bg">ABC@126.com</div>
    </div>
</div>
<script type="text/javascript">
    function goBack(){
        location.href = "lotList.html";
    }
    $("#btn-add-new").click(function () {
        $.ajax({
            "url":"/lot/add_new",
            "data":$("#form-add-new").serialize(),
            "type":"post",
            "dataType":"json",
            "success":function (json) {
                if(json.state===2000){
                    alert("添加角色成功！");
                    //还原表单控件为默认状态
                    $("#form-add-new")[0].reset();
                }else{
                    alert("添加角色失败！"+json.message);
                }
            },
            "error":function () {
                alert("您的登录信息已过期！请重新登录");
                //location.href="login.html";
            }
        });
    });

</script>
</body>
</html>
